home *** CD-ROM | disk | FTP | other *** search
/ Assassins - Ultimate CD Games Collection 4 / Assassins 4 (1999)(Weird Science).iso / misc / omega / source / guild1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-02  |  15.1 KB  |  523 lines

  1. /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
  2. /* guild1.c */
  3. /* L_ functions  */ 
  4.  
  5. /* These functions implement the various guilds. */
  6. /* They are all l_ functions since they are basically activated*/
  7. /* at some site or other. */
  8.  
  9. #include "glob.h"
  10.  
  11.  
  12. void l_merc_guild()
  13. {
  14.   pob newitem;
  15.  
  16.   print1("Legion of Destiny, Mercenary Guild, Inc.");
  17.   if (nighttime())
  18.     print2("The barracks are under curfew right now."); 
  19.   else {
  20.     print2("You enter Legion HQ, ");
  21.     if (Player.rank[LEGION] == COMMANDANT) {
  22.       nprint2("Your aide follows you to the staff room.");
  23.       morewait();
  24.       clearmsg();
  25.     }
  26.     if (Player.rank[LEGION] > 0) {
  27.       nprint2("and report to your commander.");
  28.       morewait();
  29.     }
  30.     switch(Player.rank[LEGION]) {
  31.     case 0:
  32.       nprint2("and see the Recruiting Centurion.");
  33.       morewait();
  34.       print2("Do you wish to join the Legion? [yn] ");
  35.       if (ynq2()=='y') {
  36.     clearmsg();
  37.     if (Player.rank[ARENA]>0) {
  38.       print1("The Centurion checks your record, and gets angry:");
  39.       print2("'The legion don't need any Arena Jocks. Git!'");
  40.     }
  41.     else if (Player.rank[ORDER] > 0) {
  42.       print1("The Centurion checks your record, and is amused:");
  43.       print2("'A paladin in the ranks? You must be joking.'");
  44.     }
  45.     else if (Player.con < 12) {
  46.       print1("The Centurion looks you over, sadly.");
  47.       print2("You are too fragile to join the legion.");
  48.     }
  49.     else if (Player.str < 10) {
  50.       print1("The Centurion looks at you contemptuously.");
  51.       print2("Your strength is too low to pass the physical!");
  52.     }
  53.     else {
  54.       print1("You are tested for strength and stamina...");
  55.       morewait();
  56.       nprint1(" and you pass!");
  57.       print2("Commandant ");
  58.       nprint2(Commandant);
  59.       nprint2(" shakes your hand.");
  60.       morewait();
  61.       print2("The Legion pays you a 500Au induction fee.");
  62.       morewait();
  63.       print1("You are also issued a shortsword and leather.");
  64.       print2("You are now a Legionaire.");
  65.       morewait();
  66.       clearmsg();
  67.       newitem = ((pob) checkmalloc(sizeof(objtype)));
  68.       *newitem = Objects[WEAPONID+1]; /* shortsword */
  69.       gain_item(newitem);
  70.       newitem = ((pob) checkmalloc(sizeof(objtype)));
  71.       *newitem = Objects[ARMORID+1]; /* leather */
  72.       gain_item(newitem);
  73.       Player.cash += 500;
  74.       Player.rank[LEGION] = LEGIONAIRE;
  75.       Player.guildxp[LEGION] = 1;
  76.       Player.str++; Player.con++;
  77.       Player.maxstr++; Player.maxcon++;
  78.     }
  79.       }
  80.       break;
  81.     case COMMANDANT:
  82.       print1("You find the disposition of your forces satisfactory.");
  83.       break;
  84.     case COLONEL:
  85.       if ((Player.level > Commandantlevel) &&
  86.       find_and_remove_item(CORPSEID+0,ML10+4)) {  
  87.     print1("You liberated the Demon Emperor's Regalia!");
  88.     morewait();
  89.     clearmsg();
  90.     print1("The Legion is assembled in salute to you!");
  91.     print2("The Regalia is held high for all to see and admire.");
  92.     morewait();
  93.     clearmsg(); 
  94.     print1("Commandant ");
  95.     nprint1(Commandant);
  96.     nprint1(" promotes you to replace him,");
  97.     print2("and announces his own overdue retirement.");
  98.     morewait();
  99.     clearmsg();
  100.     print1("You are the new Commandant of the Legion!");
  101.     print2("The Emperor's Regalia is sold for a ridiculous sum.");
  102.     strcpy(Commandant,Player.name);
  103.     Commandantlevel = Player.level;
  104.     morewait();
  105.     Commandantbehavior = fixnpc(4);
  106.     save_hiscore_npc(8);
  107.     clearmsg();
  108.     print1("You now know the Spell of Regeneration.");
  109.     Spells[S_REGENERATE].known = TRUE;
  110.     Player.rank[LEGION]=COMMANDANT;
  111.     Player.maxstr += 2;
  112.     Player.str += 2;
  113.     Player.maxcon += 2;
  114.     Player.con += 2;
  115.     print2("Your training is complete. You get top salary.");
  116.     Player.cash += 20000;
  117.       }
  118.       else if (Player.level <= Commandantlevel) {
  119.     clearmsg();
  120.     print1("Your CO expresses satisfaction with your progress.");
  121.     print2("But your service record does not yet permit promotion.");
  122.       }
  123.       else {
  124.     clearmsg();
  125.     print1("Why do you come empty handed?"); 
  126.     print2("You must return with the Regalia of the Demon Emperor!");
  127.       }
  128.       break;
  129.     case FORCE_LEADER:
  130.       clearmsg();
  131.       print1("Your CO expresses satisfaction with your progress.");
  132.       if (Player.guildxp[LEGION] < 4000)
  133.     print2("But your service record does not yet permit promotion.");
  134.       else  {
  135.     print2("You have been promoted to Legion Colonel!");
  136.     morewait();
  137.     print1("Your next promotion is contingent on the return of");
  138.     print2("the Regalia of the Demon Emperor.");
  139.     morewait();
  140.     print1("The Demon Emperor holds court at the base of a volcano");
  141.     print2("to the far south, in the heart of a swamp.");
  142.     morewait();
  143.     clearmsg();
  144.     print1("You have been taught the spell of heroism!");
  145.     Spells[S_HERO].known = TRUE;
  146.     Player.rank[LEGION]=COLONEL;
  147.     Player.maxstr++;
  148.     Player.str++;
  149.     Player.maxcon++;
  150.     Player.con++;
  151.     print2("You are given advanced training, and a raise.");
  152.     Player.cash += 10000;
  153.       }
  154.       break;
  155.     case CENTURION:
  156.       clearmsg();
  157.       print1("Your CO expresses satisfaction with your progress.");
  158.       if (Player.guildxp[LEGION] < 1500)
  159.     print2("But your service record does not yet permit promotion.");
  160.       else {
  161.     print2("You are now a Legion Force-Leader!");
  162.     Player.rank[LEGION]=FORCE_LEADER;
  163.     Player.maxstr++;
  164.     Player.str++;
  165.     morewait();
  166.     clearmsg();
  167.     print1("You receive more training, and bonus pay.");
  168.     Player.cash += 5000;
  169.       }
  170.       break;
  171.       case LEGIONAIRE:
  172.       clearmsg();
  173.       print1("Your CO expresses satisfaction with your progress.");
  174.       if (Player.guildxp[LEGION] < 400)
  175.     print2("But your service record does not yet permit promotion.");
  176.       else {
  177.     print2("You are promoted to Legion Centurion!");
  178.     morewait();
  179.     clearmsg();
  180.     print1("You get advanced training, and a higher salary.");
  181.     Player.rank[LEGION] = CENTURION;
  182.     Player.maxcon++;
  183.     Player.con++;
  184.     Player.cash += 2000;
  185.       }
  186.       break;
  187.     }
  188.   }
  189. }
  190.  
  191. void l_castle()
  192. {
  193.   pob o;
  194.   int x, y;
  195.  
  196.   if (Player.level < 3) {
  197.     print1("You can't possibly enter the castle, you nobody!");
  198.     print2("Come back when you are famous.");
  199.   }
  200.   else {
  201.     print1("You are ushered into the castle.");
  202.     if (Player.rank[NOBILITY]<DUKE) {
  203.       print2("His Grace, ");
  204.       nprint2(Duke);
  205.       nprint2("-- Duke of Rampart! <fanfare>");
  206.       morewait();
  207.       clearmsg();
  208.     }
  209.     if (Player.rank[NOBILITY]==0) {
  210.       print1("Well, sirrah, wouldst embark on a quest? [yn] ");
  211.       if (ynq1() == 'y') {
  212.     print2("Splendid. Bring me the head of the Goblin King.");
  213.     Player.rank[NOBILITY]=COMMONER;
  214.       }
  215.       else {
  216.     print1("You scoundrel! Guards! Take this blackguard away!");
  217.     morewait();
  218.     p_damage(25,UNSTOPPABLE,"castle guards for lese majeste");
  219.     send_to_jail();
  220.       }
  221.     }
  222.     else if (Player.rank[NOBILITY]==COMMONER) {
  223.       if (find_and_remove_item(CORPSEID,ML3+5)) {
  224.     print1("Good job, sirrah! I promote you to the rank of esquire.");
  225.     Player.rank[NOBILITY]=ESQUIRE;
  226.     gain_experience(100);
  227.     print2("Now that you have proved yourself true, another quest!");
  228.     morewait();
  229.     print1("Bring to me a Holy Defender!");
  230.     print2("One is said to be in the possession of the Great Wyrm");
  231.     morewait();
  232.     clearmsg();
  233.     print1("in the depths of the sewers below the city.");
  234.       }
  235.       else print2("Do not return until you achieve the quest, caitiff!");
  236.     }
  237.     else if (Player.rank[NOBILITY]==ESQUIRE) {
  238.       if (find_and_remove_item(WEAPONID+34,-1)) {
  239.     print1("My thanks, squire. In return, I dub thee knight!");
  240.     Player.rank[NOBILITY]=KNIGHT;
  241.     gain_experience(1000);
  242.     print2("If thou wouldst please me further...");
  243.     morewait();
  244.     print1("Bring me a suit of dragonscale armor.");
  245.     print2("You might have to kill a dragon to get one....");
  246.       }
  247.       else print2("Greetings, squire. My sword? What, you don't have it?");
  248.     }
  249.     else if (Player.rank[NOBILITY]==KNIGHT) {
  250.       if (find_and_remove_item(ARMORID+12,-1)) {
  251.     print1("Thanks, good sir knight.");
  252.     print2("Here are letters patent to a peerage!");
  253.     Player.rank[NOBILITY]=LORD;
  254.     gain_experience(10000);
  255.     morewait();
  256.     print1("If you would do me a final service...");
  257.     print2("I require the Orb of Mastery. If you would be so kind...");
  258.     morewait();
  259.     print1("By the way, you might find the Orb in the possession");
  260.     print2("Of the Elemental Master on the Astral Plane");
  261.       }
  262.       else print2("Your quest is not yet complete, sir knight.");
  263.     }
  264.     else if (Player.rank[NOBILITY]==LORD) {
  265.       if (find_item(&o,ARTIFACTID+0,-1)) {
  266.     print1("My sincerest thanks, my lord.");
  267.     print2("You have proved yourself a true paragon of chivalry");
  268.     morewait();
  269.     print1("I abdicate the Duchy in your favor....");
  270.     print2("Oh, you can keep the Orb, by the way....");
  271.     Player.rank[NOBILITY]=DUKE;
  272.     gain_experience(10000);
  273.     strcpy(Duke,Player.name);
  274.     morewait();
  275.     Dukebehavior = fixnpc(4);
  276.     save_hiscore_npc(12);
  277.     for (y = 52; y < 63; y++)
  278.         for (x = 2; x < 52; x++) {
  279.         if (Level->site[x][y].p_locf == L_TRAP_SIREN) {
  280.             Level->site[x][y].p_locf = L_NO_OP;
  281.             lset(x, y, CHANGED);
  282.         }
  283.         if (x >= 12 && loc_statusp(x, y, SECRET)) {
  284.             lreset(x, y, SECRET);
  285.             lset(x, y, CHANGED);
  286.         }
  287.         if (x >= 20 && x <= 23 && y == 56) {
  288.             Level->site[x][y].locchar = FLOOR;
  289.             lset(x, y, CHANGED);
  290.         }
  291.         }
  292.  
  293.       }
  294.       else print2("I didn't really think you were up to the task....");
  295.     }
  296.   }
  297. }
  298.  
  299.  
  300. void l_arena()
  301. {
  302.   char response;
  303.   pob newitem;
  304.   int i,prize,monsterlevel;
  305.   char *name, *corpse, *melee = NULL;
  306.  
  307.   print1("Rampart Coliseum");
  308.   if (Player.rank[ARENA] == 0) {
  309.     print2("Enter the games, or Register as a Gladiator? [e,r,ESCAPE] ");
  310.     do response = (char) mcigetc();
  311.     while ((response != 'e') && (response != 'r') && (response != ESCAPE));
  312.   }
  313.   else {
  314.     print2("Enter the games? [yn] ");
  315.     response = ynq2();
  316.     if (response == 'y') response = 'e';
  317.     else response = ESCAPE;
  318.   }
  319.   if (response == 'r') {
  320.     if (Player.rank[ARENA]>0)
  321.       print2("You're already a gladiator....");
  322.     else if (Player.rank[ORDER]>0)
  323.       print2("We don't let Paladins into our Guild.");
  324.     else if (Player.rank[LEGION]>0)
  325.       print2("We don't train no stinkin' mercs!");
  326.     else if (Player.str < 13)
  327.       print2("Yer too weak to train!");
  328.     else if (Player.agi < 12)
  329.       print2("Too clumsy to be a gladiator!");
  330.     else {
  331.       print1("Ok, yer now an Arena Trainee.");
  332.       print2("Here's a wooden sword, and a shield");
  333.       morewait();
  334.       clearmsg();
  335.       newitem = ((pob) checkmalloc(sizeof(objtype)));
  336.       *newitem = Objects[WEAPONID+17]; /* club */
  337.       gain_item(newitem);
  338.       newitem = ((pob) checkmalloc(sizeof(objtype)));
  339.       *newitem = Objects[SHIELDID+2]; /* shield */
  340.       gain_item(newitem);
  341.       Player.rank[ARENA] = TRAINEE;
  342.       Arena_Opponent = 3;
  343.       morewait();
  344.       clearmsg();
  345.       print1("You've got 5000Au credit at the Gym.");
  346.       Gymcredit+=5000;
  347.     }
  348.   }
  349.   else if (response == 'e') {
  350.     print1("OK, we're arranging a match....");
  351.     morewait();
  352.     Arena_Monster = ((pmt) checkmalloc(sizeof(montype)));
  353.     Arena_Victory = FALSE;
  354.     switch(Arena_Opponent) {
  355.     case 0: 
  356.       *Arena_Monster = Monsters[ML1+9];
  357.       break;
  358.     case 1:
  359.       *Arena_Monster = Monsters[ML0+0];
  360.       break;
  361.     case 2:
  362.       *Arena_Monster = Monsters[ML1+21];
  363.       break;
  364.     case 3:
  365.       *Arena_Monster = Monsters[ML1+6];
  366.       break;
  367.     case 4:
  368.       *Arena_Monster = Monsters[ML1+0];
  369.       break;
  370.     case 5:
  371.       *Arena_Monster = Monsters[ML2+4];
  372.       break;      
  373.     case 6:
  374.       *Arena_Monster = Monsters[ML2+0];
  375.       break;
  376.     case 7:
  377.       *Arena_Monster = Monsters[ML3+0];
  378.       break;
  379.     case 8:
  380.       *Arena_Monster = Monsters[ML2+11];
  381.       break;
  382.     case 9:
  383.       *Arena_Monster = Monsters[ML4+0];
  384.       break;
  385.     case 10:
  386.       *Arena_Monster = Monsters[ML5+5];
  387.       break;
  388.     case 11:
  389.       *Arena_Monster = Monsters[ML6+4];
  390.       break;
  391.     case 12:
  392.       *Arena_Monster = Monsters[ML6+5];
  393.       break;
  394.     case 13: 
  395.       *Arena_Monster = Monsters[ML8+2];
  396.       break;
  397.     case 14:
  398.       *Arena_Monster = Monsters[ML8+4];
  399.       break;
  400.     case 15:
  401.       *Arena_Monster = Monsters[ML9+0];
  402.       break;
  403.     default:
  404.       if ((Player.rank[ARENA] < 5) && (Player.rank[ARENA] > 0)) {
  405.     strcpy(Str1,Champion);
  406.     strcat(Str1,", the arena champion");
  407.     *Arena_Monster = Monsters[ML0+8];
  408.     name = Arena_Monster->monstring = salloc(Str1);
  409.     strcpy(Str2,"The corpse of ");
  410.     strcat(Str2,Str1);
  411.     corpse = Arena_Monster->corpsestr = salloc(Str2);
  412.     Arena_Monster->level = 20;
  413.     Arena_Monster->hp = Championlevel*Championlevel*5;
  414.     Arena_Monster->hit = Championlevel*4;
  415.     Arena_Monster->ac = Championlevel*3;
  416.     Arena_Monster->dmg = 100+Championlevel*2;
  417.     Arena_Monster->xpv = Championlevel*Championlevel*5;
  418.     Arena_Monster->speed = 3;
  419.     melee = Arena_Monster->meleestr = (char *) checkmalloc(30*sizeof(char));
  420.     strcpy(Arena_Monster->meleestr,"");
  421.     for(i=0;i<Championlevel/5;i++)
  422.       strcat(Arena_Monster->meleestr,"L?R?");
  423.     m_status_set(Arena_Monster, MOBILE);
  424.     m_status_set(Arena_Monster, HOSTILE);
  425.       }
  426.       else {
  427.     do 
  428.       *Arena_Monster = Monsters[random_range(ML9-ML0)+ML0];
  429.     while ((Arena_Monster->uniqueness != COMMON) || 
  430.            (Arena_Monster->dmg == 0));
  431.       }
  432.       break;
  433.     }
  434.     monsterlevel = Arena_Monster->level;
  435.     if (Arena_Monster->level != 20) {
  436.       strcpy(Str1,nameprint());
  437.       strcat(Str1," the ");
  438.       strcat(Str1,Arena_Monster->monstring);
  439.       name = Arena_Monster->monstring = salloc(Str1);
  440.       strcpy(Str2,"The corpse of ");
  441.       strcat(Str2,Str1);
  442.       corpse = Arena_Monster->corpsestr = salloc(Str2);
  443.     }
  444.     Arena_Monster->uniqueness = UNIQUE_MADE;
  445.     print1("You have a challenger: ");
  446.     print2(Arena_Monster->monstring);
  447.     Arena_Monster->attacked = TRUE;
  448.     m_status_set(Arena_Monster,HOSTILE);
  449.     morewait();
  450.     clearmsg();
  451.     change_environment(E_ARENA);
  452.     print1("Let the battle begin....");
  453.  
  454.     time_clock(TRUE);
  455.     while (Current_Environment == E_ARENA) 
  456.       time_clock(FALSE);
  457.  
  458.     free(name);        /* hey - why waste space? */
  459.     free(corpse);
  460.     if (melee)
  461.       free(melee);
  462.     if (! Arena_Victory) {
  463.       print1("The crowd boos your craven behavior!!!");
  464.       if (Player.rank[ARENA] > 0) {
  465.     print2("You are thrown out of the Gladiator's Guild!");
  466.     morewait();
  467.     clearmsg();
  468.     if (Gymcredit > 0) print1("Your credit at the gym is cut off!");
  469.     Gymcredit = 0;
  470.     Player.rank[ARENA] = -1;
  471.       }
  472.     }      
  473.     else {
  474.       Arena_Opponent++;
  475.       if (monsterlevel == 20) {
  476.     print1("The crowd roars its approval!");
  477.     if (Player.rank[ARENA]) {
  478.       print2("You are the new Arena Champion!");
  479.       Championlevel = Player.level;
  480.       strcpy(Champion,Player.name);
  481.       Player.rank[ARENA] = 5;
  482.       morewait();
  483.       Championbehavior = fixnpc(4);
  484.       save_hiscore_npc(11);
  485.       print1("You are awarded the Champion's Spear: Victrix!");
  486.       morewait();
  487.       newitem = ((pob) checkmalloc(sizeof(objtype)));
  488.       *newitem = Objects[WEAPONID+35];
  489.       gain_item(newitem);
  490.       
  491.     }
  492.     else {
  493.       print1("As you are not an official gladiator,");
  494.       nprint1("you are not made Champion.");
  495.       morewait();
  496.     }
  497.       }
  498.       morewait();
  499.       clearmsg();
  500.       print1("Good fight! ");
  501.       nprint1("Your prize is: ");
  502.       prize = max(25,monsterlevel * 50);
  503.       if (Player.rank[ARENA] > 0) prize *= 2;
  504.       mnumprint(prize);
  505.       nprint1("Au.");
  506.       Player.cash+=prize;
  507.       if ((Player.rank[ARENA]<4) &&
  508.       (Arena_Opponent>5) &&
  509.       (Arena_Opponent % 3 == 0)) {
  510.     if (Player.rank[ARENA]>0) {
  511.       Player.rank[ARENA]++;
  512.       morewait();
  513.       print1("You've been promoted to a stronger class!");
  514.       print2("You are also entitled to additional training.");
  515.       Gymcredit+=Arena_Opponent*1000;
  516.     }
  517.       }
  518.     }
  519.     xredraw();
  520.   }
  521.   else clearmsg();
  522. }
  523.